home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / mcr68.c < prev    next >
C/C++ Source or Header  |  2000-04-23  |  55KB  |  1,472 lines

  1. /***************************************************************************
  2.  
  3.     Midway MCR-68k system
  4.  
  5.     Currently implemented:
  6.         * Zwackery (Chip Squeak Deluxe)
  7.         * Xenopohobe (Sounds Good)
  8.         * Spy Hunter 2 (Sounds Good/Turbo Chip Squeak)
  9.         * Blasted (Sounds Good)
  10.         * Arch Rivals
  11.         * Tri-Sports
  12.         * Pigskin 621AD
  13.  
  14.     Emulation by Bryan McPhail, mish@tendril.co.uk and
  15.     Aaron Giles agiles@pobox.com
  16.  
  17. ****************************************************************************
  18.  
  19.     Memory map
  20.  
  21. ****************************************************************************
  22.  
  23.     ========================================================================
  24.     CPU #1
  25.     ========================================================================
  26.     000000-03FFFF   R     xxxxxxxx xxxxxxxx    Program ROM
  27.     060000-063FFF   R/W   xxxxxxxx xxxxxxxx    Program RAM
  28.     070000-070FFF   R/W   xxxxxxxx xxxxxxxx    Background video RAM
  29.     071000-071FFF   R/W   xxxxxxxx xxxxxxxx    Additional RAM
  30.     080000-080FFF   R/W   xxxxxxxx xxxxxxxx    Sprite RAM
  31.     090000-0900FF     W   xxxxxxxx xxxxxxxx    Palette RAM
  32.     0A0000-0A000F   R/W   xxxxxxxx --------    M6840 I/O
  33.     0B0000-0B0001     W   -------- --------    Watchdog
  34.     0C0000-0C0001     W   -------- xxxxxxxx    Sound I/O
  35.     0D0000-0D0001   R     xxxxxxxx xxxxxxxx    External inputs
  36.     0E0000-0E0001   R     xxxxxxxx xxxxxxxx    External inputs
  37.     0F0000-0F0001   R     xxxxxxxx xxxxxxxx    External inputs
  38.     ========================================================================
  39.     Interrupts:
  40.         NMI ???
  41.         INT generated by CTC
  42.     ========================================================================
  43.     NOTE: Pigskin and Tri-Sports have similar memory maps; the addresses
  44.             are simply shuffled around
  45.     ========================================================================
  46.  
  47. ***************************************************************************/
  48.  
  49. #include "driver.h"
  50. #include "machine/mcr.h"
  51. #include "sndhrdw/mcr.h"
  52. #include "sndhrdw/williams.h"
  53. #include "vidhrdw/generic.h"
  54.  
  55.  
  56. extern UINT8 mcr68_sprite_clip;
  57. extern INT8 mcr68_sprite_xoffset;
  58.  
  59. static UINT8 *control_word;
  60.  
  61.  
  62. WRITE_HANDLER( mcr68_videoram_w );
  63. WRITE_HANDLER( mcr68_paletteram_w );
  64. void mcr68_vh_screenrefresh(struct osd_bitmap *bitmap, int full_refresh);
  65.  
  66. WRITE_HANDLER( zwackery_videoram_w );
  67. WRITE_HANDLER( zwackery_paletteram_w );
  68. WRITE_HANDLER( zwackery_spriteram_w );
  69. void zwackery_convert_color_prom(unsigned char *palette, unsigned short *colortable, const unsigned char *color_prom);
  70. void zwackery_vh_screenrefresh(struct osd_bitmap *bitmap, int full_refresh);
  71.  
  72.  
  73.  
  74. /*************************************
  75.  *
  76.  *    Zwackery-specific handlers
  77.  *
  78.  *************************************/
  79.  
  80. READ_HANDLER( zwackery_port_2_r )
  81. {
  82.     int result = input_port_2_r(offset);
  83.     int wheel = input_port_5_r(offset);
  84.  
  85.     return result | ((wheel >> 2) & 0x3e);
  86. }
  87.  
  88.  
  89. static READ_HANDLER( zwackery_6840_r )
  90. {
  91.     /* Zwackery does a timer test:                          */
  92.     /* It loads $1388 into one of the timers clocked by E   */
  93.     /* Then it sits in a tight loop counting down from $4E4 */
  94.     /*       BTST #$1,($2,A0)                               */
  95.     /*       DBNE D1,*-6                                    */
  96.     /* It expects D1 to end up between 0 and 5; in order to */
  97.     /* make this happen, we must assume that reads from the */
  98.     /* 6840 take 14 additional cycles                       */
  99.     *cpuintf[Machine->drv->cpu[0].cpu_type & ~CPU_FLAGS_MASK].icount -= 14;
  100.     return mcr68_6840_upper_r(offset);
  101. }
  102.  
  103.  
  104.  
  105. /*************************************
  106.  *
  107.  *    Xenophobe-specific handlers
  108.  *
  109.  *************************************/
  110.  
  111. static WRITE_HANDLER( xenophobe_control_w )
  112. {
  113.     int oldword = READ_WORD(&control_word[offset]);
  114.     int newword = COMBINE_WORD(oldword, data);
  115.     WRITE_WORD(&control_word[offset], newword);
  116.  
  117. /*    soundsgood_reset_w(~newword & 0x0020);*/
  118.     soundsgood_data_w(offset, ((newword & 0x000f) << 1) | ((newword & 0x0010) >> 4));
  119. }
  120.  
  121.  
  122.  
  123. /*************************************
  124.  *
  125.  *    Blasted-specific handlers
  126.  *
  127.  *************************************/
  128.  
  129. static WRITE_HANDLER( blasted_control_w )
  130. {
  131.     int oldword = READ_WORD(&control_word[offset]);
  132.     int newword = COMBINE_WORD(oldword, data);
  133.     WRITE_WORD(&control_word[offset], newword);
  134.  
  135. /*    soundsgood_reset_w(~newword & 0x0020);*/
  136.     soundsgood_data_w(offset, (newword >> 8) & 0x1f);
  137. }
  138.  
  139.  
  140.  
  141. /*************************************
  142.  *
  143.  *    Spy Hunter 2-specific handlers
  144.  *
  145.  *************************************/
  146.  
  147. static READ_HANDLER( spyhunt2_port_0_r )
  148. {
  149.     int result = input_port_0_r(offset);
  150.     int which = (READ_WORD(control_word) >> 3) & 3;
  151.     int analog = readinputport(3 + which);
  152.     return result | ((soundsgood_status_r(0) & 1) << 5) | (analog << 8);
  153. }
  154.  
  155.  
  156. static READ_HANDLER( spyhunt2_port_1_r )
  157. {
  158.     int result = input_port_1_r(offset);
  159.     return result | ((turbocs_status_r(0) & 1) << 7);
  160. }
  161.  
  162.  
  163. static WRITE_HANDLER( spyhunt2_control_w )
  164. {
  165.     int oldword = READ_WORD(&control_word[offset]);
  166.     int newword = COMBINE_WORD(oldword, data);
  167.     WRITE_WORD(&control_word[offset], newword);
  168.  
  169. /*     turbocs_reset_w(~newword & 0x0080);*/
  170.     turbocs_data_w(offset, (newword >> 8) & 0x001f);
  171.  
  172. /*    soundsgood_reset_w(~newword & 0x2000);*/
  173.     soundsgood_data_w(offset, (newword >> 8) & 0x001f);
  174. }
  175.  
  176.  
  177.  
  178. /*************************************
  179.  *
  180.  *    Arch Rivals-specific handlers
  181.  *
  182.  *************************************/
  183.  
  184. static READ_HANDLER( archrivl_port_1_r )
  185. {
  186.     int joystick = input_port_3_r(offset);
  187.     int result = 0;
  188.  
  189.     /* each axis of the 49-way joystick is mapped like this:*/
  190.     /*      0 8      = neutral                              */
  191.     /*      1        = slightly left/up                     */
  192.     /*      2 3      = middle left/up                       */
  193.     /*      4 5 6 7  = full left/up                         */
  194.     /*      C        = slightly right/down                  */
  195.     /*      A E      = middle right/down                    */
  196.     /*      9 B D F  = full right/down                      */
  197.  
  198.     if (joystick & 0x0001) result |= 0x0040;
  199.     else if (joystick & 0x0002) result |= 0x0090;
  200.  
  201.     if (joystick & 0x0004) result |= 0x0004;
  202.     else if (joystick & 0x0008) result |= 0x0009;
  203.  
  204.     if (joystick & 0x0010) result |= 0x4000;
  205.     else if (joystick & 0x0020) result |= 0x9000;
  206.  
  207.     if (joystick & 0x0040) result |= 0x0400;
  208.     else if (joystick & 0x0080) result |= 0x0900;
  209.  
  210.     return result;
  211. }
  212.  
  213.  
  214. static WRITE_HANDLER( archrivl_control_w )
  215. {
  216.     int oldword = READ_WORD(&control_word[offset]);
  217.     int newword = COMBINE_WORD(oldword, data);
  218.     WRITE_WORD(&control_word[offset], newword);
  219.  
  220.     williams_cvsd_reset_w(~newword & 0x0400);
  221.     williams_cvsd_data_w(offset, newword & 0x3ff);
  222. }
  223.  
  224.  
  225.  
  226. /*************************************
  227.  *
  228.  *    Pigskin-specific handlers
  229.  *
  230.  *************************************/
  231.  
  232. static UINT8 protection_data[5];
  233. static WRITE_HANDLER( pigskin_protection_w )
  234. {
  235.     /* ignore upper-byte only */
  236.     if (data & 0x00ff0000) return;
  237.  
  238.     /* track the last 5 bytes */
  239.     protection_data[0] = protection_data[1];
  240.     protection_data[1] = protection_data[2];
  241.     protection_data[2] = protection_data[3];
  242.     protection_data[3] = protection_data[4];
  243.     protection_data[4] = data;
  244.  
  245.     logerror("%06X:protection_w=%02X\n", cpu_getpreviouspc(), data & 0xff);
  246. }
  247.  
  248.  
  249. static READ_HANDLER( pigskin_protection_r )
  250. {
  251.     /* based on the last 5 bytes return a value */
  252.     if (protection_data[4] == 0xe3 && protection_data[3] == 0x94)
  253.         return 0x00;    /* must be <= 1 */
  254.     if (protection_data[4] == 0xc7 && protection_data[3] == 0x7b && protection_data[2] == 0x36)
  255.         return 0x00;    /* must be <= 1 */
  256.     if (protection_data[4] == 0xc7 && protection_data[3] == 0x7b)
  257.         return 0x07;    /* must be > 5 */
  258.     if (protection_data[4] == 0xc7 && protection_data[3] == 0x1f && protection_data[2] == 0x03 &&
  259.         protection_data[1] == 0x25 && protection_data[0] == 0x36)
  260.         return 0x00;    /* must be < 3 */
  261.  
  262.     logerror("Protection read after unrecognized sequence: %02X %02X %02X %02X %02X\n",
  263.             protection_data[0], protection_data[1], protection_data[2], protection_data[3], protection_data[4]);
  264.  
  265.     return 0x00;
  266. }
  267.  
  268.  
  269. static READ_HANDLER( pigskin_port_1_r )
  270. {
  271.     int joystick = input_port_3_r(offset);
  272.     int result = input_port_1_r(offset);
  273.  
  274.     /* see archrivl_port_1_r for 49-way joystick description */
  275.  
  276.     if (joystick & 0x0001) result |= 0x4000;
  277.     else if (joystick & 0x0002) result |= 0x9000;
  278.  
  279.     if (joystick & 0x0004) result |= 0x0400;
  280.     else if (joystick & 0x0008) result |= 0x0900;
  281.  
  282.     return result;
  283. }
  284.  
  285.  
  286. static READ_HANDLER( pigskin_port_2_r )
  287. {
  288.     int joystick = input_port_3_r(offset);
  289.     int result = input_port_2_r(offset);
  290.  
  291.     /* see archrivl_port_1_r for 49-way joystick description */
  292.  
  293.     if (joystick & 0x0010) result |= 0x4000;
  294.     else if (joystick & 0x0020) result |= 0x9000;
  295.  
  296.     if (joystick & 0x0040) result |= 0x0400;
  297.     else if (joystick & 0x0080) result |= 0x0900;
  298.  
  299.     return result;
  300. }
  301.  
  302.  
  303.  
  304. /*************************************
  305.  *
  306.  *    Tri-Sports-specific handlers
  307.  *
  308.  *************************************/
  309.  
  310. static READ_HANDLER( trisport_port_1_r )
  311. {
  312.     int xaxis = (INT8)input_port_3_r(offset);
  313.     int yaxis = (INT8)input_port_4_r(offset);
  314.     int result = input_port_1_r(offset);
  315.  
  316.     result |= (xaxis & 0x3c) << 6;
  317.     result |= (yaxis & 0x3c) << 10;
  318.  
  319.     return result;
  320. }
  321.  
  322.  
  323.  
  324. /*************************************
  325.  *
  326.  *    Main CPU memory handlers
  327.  *
  328.  *************************************/
  329.  
  330. static struct MemoryReadAddress mcr68_readmem[] =
  331. {
  332.     { 0x000000, 0x03ffff, MRA_ROM },
  333.     { 0x060000, 0x063fff, MRA_BANK2 },
  334.     { 0x070000, 0x070fff, MRA_BANK3 },
  335.     { 0x071000, 0x071fff, MRA_BANK4 },
  336.     { 0x080000, 0x080fff, MRA_BANK5 },
  337.     { 0x0a0000, 0x0a000f, mcr68_6840_upper_r },
  338.     { 0x0d0000, 0x0dffff, input_port_0_r },
  339.     { 0x0e0000, 0x0effff, input_port_1_r },
  340.     { 0x0f0000, 0x0fffff, input_port_2_r },
  341.     { -1 }  /* end of table */
  342. };
  343.  
  344.  
  345. static struct MemoryWriteAddress mcr68_writemem[] =
  346. {
  347.     { 0x000000, 0x03ffff, MWA_ROM },
  348.     { 0x060000, 0x063fff, MWA_BANK2 },
  349.     { 0x070000, 0x070fff, mcr68_videoram_w, &videoram, &videoram_size },
  350.     { 0x071000, 0x071fff, MWA_BANK4 },
  351.     { 0x080000, 0x080fff, MWA_BANK5, &spriteram, &spriteram_size },
  352.     { 0x090000, 0x09007f, mcr68_paletteram_w, &paletteram },
  353.     { 0x0a0000, 0x0a000f, mcr68_6840_upper_w },
  354.     { 0x0b0000, 0x0bffff, watchdog_reset_w },
  355.     { 0x0c0000, 0x0cffff, MWA_NOP, &control_word },
  356.     { -1 }  /* end of table */
  357. };
  358.  
  359.  
  360.  
  361. /*************************************
  362.  *
  363.  *    Zwackery main CPU memory handlers
  364.  *
  365.  *************************************/
  366.  
  367. static struct MemoryReadAddress zwackery_readmem[] =
  368. {
  369.     { 0x000000, 0x037fff, MRA_ROM },
  370.     { 0x080000, 0x080fff, MRA_BANK2 },
  371.     { 0x084000, 0x084fff, MRA_BANK3 },
  372.     { 0x100000, 0x10000f, zwackery_6840_r },
  373.     { 0x104000, 0x104007, pia_2_r },
  374.     { 0x108000, 0x108007, pia_3_r },
  375.     { 0x10c000, 0x10c007, pia_4_r },
  376.     { 0x800000, 0x800fff, MRA_BANK4 },
  377.     { 0x802000, 0x803fff, paletteram_word_r },
  378.     { 0xc00000, 0xc00fff, MRA_BANK5 },
  379.     { -1 }  /* end of table */
  380. };
  381.  
  382.  
  383. static struct MemoryWriteAddress zwackery_writemem[] =
  384. {
  385.     { 0x000000, 0x037fff, MWA_ROM },
  386.     { 0x080000, 0x080fff, MWA_BANK2 },
  387.     { 0x084000, 0x084fff, MWA_BANK3 },
  388.     { 0x100000, 0x10000f, mcr68_6840_upper_w },
  389.     { 0x104000, 0x104007, pia_2_w },
  390.     { 0x108000, 0x108007, pia_3_w },
  391.     { 0x10c000, 0x10c007, pia_4_w },
  392.     { 0x800000, 0x800fff, zwackery_videoram_w, &videoram, &videoram_size },
  393.     { 0x802000, 0x803fff, zwackery_paletteram_w, &paletteram },
  394.     { 0xc00000, 0xc00fff, zwackery_spriteram_w, &spriteram, &spriteram_size },
  395.     { -1 }  /* end of table */
  396. };
  397.  
  398.  
  399.  
  400. /*************************************
  401.  *
  402.  *    Pigskin CPU memory handlers
  403.  *
  404.  *************************************/
  405.  
  406. static struct MemoryReadAddress pigskin_readmem[] =
  407. {
  408.     { 0x000000, 0x03ffff, MRA_ROM },
  409.     { 0x080000, 0x08ffff, pigskin_port_1_r },
  410.     { 0x0a0000, 0x0affff, pigskin_port_2_r },
  411.     { 0x100000, 0x100fff, MRA_BANK2 },
  412.     { 0x120000, 0x120001, pigskin_protection_r },
  413.     { 0x140000, 0x143fff, MRA_BANK3 },
  414.     { 0x160000, 0x1607ff, MRA_BANK4 },
  415.     { 0x180000, 0x18000f, mcr68_6840_upper_r },
  416.     { 0x1e0000, 0x1effff, input_port_0_r },
  417.     { -1 }  /* end of table */
  418. };
  419.  
  420.  
  421. static struct MemoryWriteAddress pigskin_writemem[] =
  422. {
  423.     { 0x000000, 0x03ffff, MWA_ROM },
  424.     { 0x0c0000, 0x0c007f, mcr68_paletteram_w, &paletteram },
  425.     { 0x0e0000, 0x0effff, watchdog_reset_w },
  426.     { 0x100000, 0x100fff, mcr68_videoram_w, &videoram, &videoram_size },
  427.     { 0x120000, 0x120001, pigskin_protection_w },
  428.     { 0x140000, 0x143fff, MWA_BANK3 },
  429.     { 0x160000, 0x1607ff, MWA_BANK4, &spriteram, &spriteram_size },
  430.     { 0x180000, 0x18000f, mcr68_6840_upper_w },
  431.     { 0x1a0000, 0x1affff, MWA_NOP, &control_word },
  432.     { -1 }  /* end of table */
  433. };
  434.  
  435.  
  436.  
  437. /*************************************
  438.  *
  439.  *    Tri-Sports CPU memory handlers
  440.  *
  441.  *************************************/
  442.  
  443. static struct MemoryReadAddress trisport_readmem[] =
  444. {
  445.     { 0x000000, 0x03ffff, MRA_ROM },
  446.     { 0x080000, 0x08ffff, trisport_port_1_r },
  447.     { 0x0a0000, 0x0affff, input_port_2_r },
  448.     { 0x100000, 0x103fff, MRA_BANK2 },
  449.     { 0x140000, 0x1407ff, MRA_BANK3 },
  450.     { 0x160000, 0x160fff, MRA_BANK4 },
  451.     { 0x180000, 0x18000f, mcr68_6840_upper_r },
  452.     { 0x1e0000, 0x1effff, input_port_0_r },
  453.     { -1 }  /* end of table */
  454. };
  455.  
  456.  
  457. static struct MemoryWriteAddress trisport_writemem[] =
  458. {
  459.     { 0x000000, 0x03ffff, MWA_ROM },
  460.     { 0x100000, 0x103fff, MWA_BANK2 },
  461.     { 0x120000, 0x12007f, mcr68_paletteram_w, &paletteram },
  462.     { 0x140000, 0x1407ff, MWA_BANK3, &spriteram, &spriteram_size },
  463.     { 0x160000, 0x160fff, mcr68_videoram_w, &videoram, &videoram_size },
  464.     { 0x180000, 0x18000f, mcr68_6840_upper_w },
  465.     { 0x1a0000, 0x1affff, MWA_NOP, &control_word },
  466.     { 0x1c0000, 0x1cffff, watchdog_reset_w },
  467.     { -1 }  /* end of table */
  468. };
  469.  
  470.  
  471.  
  472. /*************************************
  473.  *
  474.  *    Port definitions
  475.  *
  476.  *************************************/
  477.  
  478. INPUT_PORTS_START( zwackery )
  479.     PORT_START
  480.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  481.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  482.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
  483.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
  484.     PORT_SERVICE( 0x0010, IP_ACTIVE_LOW )
  485.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN4 )
  486.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT )
  487.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )    /* sword */
  488.  
  489.     PORT_START
  490.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  491.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  492.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  493.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  494.     PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )    /* sound communications */
  495.  
  496.     PORT_START
  497.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 )    /* spell up */
  498.     PORT_BIT( 0x3e, IP_ACTIVE_HIGH, IPT_UNUSED )    /* encoder wheel */
  499.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )    /* shield */
  500.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 )    /* spell down */
  501.  
  502.     PORT_START
  503.     PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
  504.  
  505.     PORT_START
  506.     PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
  507.     PORT_DIPSETTING(    0x05, DEF_STR( 6C_1C ) )
  508.     PORT_DIPSETTING(    0x04, DEF_STR( 5C_1C ) )
  509.     PORT_DIPSETTING(    0x03, DEF_STR( 4C_1C ) )
  510.     PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
  511.     PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
  512.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  513.     PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
  514.     PORT_DIPSETTING(    0x07, DEF_STR( Free_Play ) )
  515.     PORT_DIPNAME( 0x38, 0x00, "Buy-in" )
  516.     PORT_DIPSETTING(    0x00, "1 coin" )
  517.     PORT_DIPSETTING(    0x08, "2 coins" )
  518.     PORT_DIPSETTING(    0x10, "3 coins" )
  519.     PORT_DIPSETTING(    0x18, "4 coins" )
  520.     PORT_DIPSETTING(    0x20, "5 coins" )
  521.     PORT_DIPSETTING(    0x28, "6 coins" )
  522.     PORT_DIPSETTING(    0x30, "7 coins" )
  523.     PORT_DIPSETTING(    0x38, "None" )
  524.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Difficulty ) )
  525.     PORT_DIPSETTING(    0xc0, "Easier" )
  526.     PORT_DIPSETTING(    0x00, "Normal" )
  527.     PORT_DIPSETTING(    0x40, "Harder" )
  528.     PORT_DIPSETTING(    0x80, "Hardest" )
  529.  
  530.     PORT_START
  531.     PORT_ANALOGX( 0xff, 0x00, IPT_DIAL | IPF_REVERSE, 50, 10, 0, 0, KEYCODE_Z, KEYCODE_X, 0, 0 )
  532. INPUT_PORTS_END
  533.  
  534.  
  535. INPUT_PORTS_START( xenophob )
  536.     PORT_START
  537.     PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
  538.     PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
  539.     PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 )
  540.     PORT_BIT( 0x0018, IP_ACTIVE_LOW, IPT_UNUSED )
  541.     PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
  542.     PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_TILT )
  543.     PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
  544.     PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER1 )
  545.     PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER1 )
  546.     PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER1 )
  547.     PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
  548.     PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  549.     PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
  550.     PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  551.     PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
  552.  
  553.     PORT_START
  554.     PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER3 )
  555.     PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER3 )
  556.     PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER3 )
  557.     PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER3 )
  558.     PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
  559.     PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
  560.     PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
  561.     PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
  562.     PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
  563.     PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
  564.     PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
  565.     PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  566.     PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  567.     PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
  568.     PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  569.     PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
  570.  
  571.     PORT_START
  572.     PORT_BIT( 0x0003, IP_ACTIVE_LOW, IPT_UNUSED )
  573.     PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Free_Play ) )
  574.     PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
  575.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  576.     PORT_DIPNAME( 0x0008, 0x0008, "Coins per Life Unit" )
  577.     PORT_DIPSETTING(      0x0008, "1" )
  578.     PORT_DIPSETTING(      0x0000, "2" )
  579.     PORT_DIPNAME( 0x0010, 0x0010, "Life Unit" )
  580.     PORT_DIPSETTING(      0x0010, "1000" )
  581.     PORT_DIPSETTING(      0x0000, "2000" )
  582.     PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) )
  583.     PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
  584.     PORT_DIPSETTING(      0x0020, DEF_STR( On ) )
  585.     PORT_DIPNAME( 0x00c0, 0x0000, DEF_STR( Difficulty ) )
  586.     PORT_DIPSETTING(      0x0040, "Easy" )
  587.     PORT_DIPSETTING(      0x0000, "Medium" )
  588.     PORT_DIPSETTING(      0x0080, "Hard" )
  589. /*    PORT_DIPSETTING(      0x00c0, "Medium" )*/
  590.     PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
  591. INPUT_PORTS_END
  592.  
  593.  
  594. INPUT_PORTS_START( spyhunt2 )
  595.     PORT_START
  596.     PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
  597.     PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
  598.     PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
  599.     PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START2 )
  600.     PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_TILT )
  601.     PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* SG status */
  602.     PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE )
  603.     PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
  604.     PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  605.  
  606.     PORT_START
  607.     PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON5 | IPF_PLAYER2 ) /* 1st gear */
  608.     PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON6 | IPF_PLAYER2 ) /* 2nd gear */
  609.     PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON7 | IPF_PLAYER2 ) /* 3rd gear */
  610.     PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNUSED )
  611.     PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON5 | IPF_PLAYER1 ) /* 1st gear */
  612.     PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON6 | IPF_PLAYER1 ) /* 2nd gear */
  613.     PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON7 | IPF_PLAYER1 ) /* 3rd gear */
  614.     PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNUSED )               /* TCS status */
  615.     PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 ) /* Left Trigger */
  616.     PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 ) /* Left Button */
  617.     PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 ) /* Right Trigger */
  618.     PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER2 ) /* Right Button */
  619.     PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 ) /* Left Trigger */
  620.     PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 ) /* Left Button */
  621.     PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 ) /* Right Trigger */
  622.     PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER1 ) /* Right Button */
  623.  
  624.     PORT_START    /* IN3 -- dipswitches */
  625.     PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coinage ) )
  626.     PORT_DIPSETTING(      0x0002, DEF_STR( 2C_1C ) )
  627.     PORT_DIPSETTING(      0x0003, DEF_STR( 1C_1C ) )
  628.     PORT_DIPSETTING(      0x0001, DEF_STR( 1C_2C ) )
  629.     /*PORT_DIPSETTING(      0x0000, DEF_STR( 1C_2C ) )*/
  630.     PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Free_Play ) )
  631.     PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
  632.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  633.     PORT_DIPNAME( 0x0018, 0x0008, "Point Threshholds" )
  634.     PORT_DIPSETTING(      0x0008, "Easy" )
  635.     PORT_DIPSETTING(      0x0018, "Medium" )
  636.     PORT_DIPSETTING(      0x0010, "Hard" )
  637.     PORT_DIPSETTING(      0x0000, "Hardest" )
  638.     PORT_DIPNAME( 0x0060, 0x0060, "Free Timer After" )
  639.     PORT_DIPSETTING(      0x0000, "30 sec" )
  640.     PORT_DIPSETTING(      0x0040, "45 sec" )
  641.     PORT_DIPSETTING(      0x0060, "60 sec" )
  642.     PORT_DIPSETTING(      0x0020, "90 sec" )
  643.     PORT_BITX( 0x0080,    0x0080, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Rack Advance", KEYCODE_F1, IP_JOY_NONE )
  644.     PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
  645.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  646.     PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
  647.  
  648.     PORT_START    /* analog ports for steering and pedals */
  649.     PORT_ANALOG( 0xff, 0x30, IPT_PEDAL | IPF_PLAYER2 | IPF_REVERSE, 100, 10, 0x30, 0xff )
  650.  
  651.     PORT_START
  652.     PORT_ANALOG( 0xff, 0x30, IPT_PEDAL | IPF_PLAYER1 | IPF_REVERSE, 100, 10, 0x30, 0xff )
  653.  
  654.     PORT_START
  655.     PORT_ANALOG( 0xff, 0x80, IPT_PADDLE | IPF_PLAYER2 | IPF_REVERSE, 80, 10, 0x10, 0xf0 )
  656.  
  657.     PORT_START
  658.     PORT_ANALOG( 0xff, 0x80, IPT_PADDLE | IPF_PLAYER1 | IPF_REVERSE, 80, 10, 0x10, 0xf0 )
  659. INPUT_PORTS_END
  660.  
  661.  
  662. INPUT_PORTS_START( blasted )
  663.     PORT_START
  664.     PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
  665.     PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
  666.     PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED/* credit w/bill */ )
  667.     PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNUSED )
  668.     PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_TILT )
  669.     PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED )
  670.     PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_COIN4 )
  671.     PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
  672.     PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  673.     PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 )
  674.     PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  675.     PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2 )
  676.     PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNUSED/* credit 1 w/bill */ )
  677.     PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED/* credit 2 w/bill */ )
  678.     PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
  679.  
  680.     PORT_START
  681.     PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER1 )
  682.     PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
  683.     PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER1 )
  684.     PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER1 )
  685.     PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
  686.     PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  687.     PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
  688.     PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
  689.     PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
  690.  
  691.     PORT_START
  692.     PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coinage ) )
  693.     PORT_DIPSETTING(      0x0002, DEF_STR( 2C_1C ) )
  694.     PORT_DIPSETTING(      0x0003, DEF_STR( 1C_1C ) )
  695.     PORT_DIPSETTING(      0x0001, DEF_STR( 1C_2C ) )
  696.     /*PORT_DIPSETTING(      0x0000, DEF_STR( 1C_2C ) )*/
  697.     PORT_DIPNAME( 0x000c, 0x0000, DEF_STR( Difficulty ) )
  698.     PORT_DIPSETTING(      0x0008, "Easy" )
  699.     PORT_DIPSETTING(      0x0000, "Medium" )
  700.     PORT_DIPSETTING(      0x0004, "Hard" )
  701. /*    PORT_DIPSETTING(      0x000c, "Medium" )*/
  702.     PORT_DIPNAME( 0x0020, 0x0020, "Dollar Receptor" )
  703.     PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
  704.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  705.     PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Demo_Sounds ) )
  706.     PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
  707.     PORT_DIPSETTING(      0x0040, DEF_STR( On ) )
  708.     PORT_BITX( 0x0080,    0x0080, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Rack Advance", KEYCODE_F1, IP_JOY_NONE )
  709.     PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
  710.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  711.     PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
  712. INPUT_PORTS_END
  713.  
  714.  
  715. INPUT_PORTS_START( archrivl )
  716.     PORT_START
  717.     PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
  718.     PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
  719.     PORT_BIT( 0x000c, IP_ACTIVE_LOW, IPT_UNUSED )
  720.     PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_TILT )
  721.     PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED )
  722.     PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_COIN4 )
  723.     PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
  724.     PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 )
  725.     PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2 )
  726.     PORT_BIT( 0x0c00, IP_ACTIVE_LOW, IPT_UNUSED )
  727.     PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  728.     PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  729.     PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  730.     PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  731.  
  732.     PORT_START
  733.     PORT_BIT( 0xffff, IP_ACTIVE_HIGH, IPT_UNUSED )    /* player 1/2 joysticks go here */
  734.  
  735.     PORT_START
  736.     PORT_DIPNAME( 0x0003, 0x0003, "Game Time" )
  737.     PORT_DIPSETTING(      0x0003, "Preset Time" )
  738.     PORT_DIPSETTING(      0x0002, "Preset + 10sec" )
  739.     PORT_DIPSETTING(      0x0001, "Preset + 20sec" )
  740.     PORT_DIPSETTING(      0x0000, "Preset + 30sec" )
  741.     PORT_DIPNAME( 0x001c, 0x001c, DEF_STR( Coinage ) )
  742.     PORT_DIPSETTING(      0x0014, DEF_STR( 3C_1C ) )
  743.     PORT_DIPSETTING(      0x0018, DEF_STR( 2C_1C ) )
  744.     PORT_DIPSETTING(      0x001c, DEF_STR( 1C_1C ) )
  745.     PORT_DIPSETTING(      0x0010, DEF_STR( 2C_3C ) )
  746.     PORT_DIPSETTING(      0x000c, DEF_STR( 1C_2C ) )
  747.     PORT_DIPSETTING(      0x0008, DEF_STR( 1C_3C ) )
  748.     PORT_DIPSETTING(      0x0004, DEF_STR( 1C_5C ) )
  749.     PORT_DIPSETTING(      0x0000, DEF_STR( 1C_6C ) )
  750.     PORT_DIPNAME( 0x0020, 0x0020, "Team Names" )
  751.     PORT_DIPSETTING(      0x0020, "Default" )
  752.     PORT_DIPSETTING(      0x0000, "Hometown Heroes" )
  753.     PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Demo_Sounds ) )
  754.     PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
  755.     PORT_DIPSETTING(      0x0040, DEF_STR( On ) )
  756.     PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Free_Play ) )
  757.     PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
  758.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  759.     PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
  760.  
  761.     PORT_START    /* 49-way joystick simulator */
  762.     PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER1 )
  763.     PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER1 )
  764.     PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER1 )
  765.     PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
  766.     PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
  767.     PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
  768.     PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
  769.     PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  770. INPUT_PORTS_END
  771.  
  772. INPUT_PORTS_START( pigskin )
  773.     PORT_START
  774.     PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
  775.     PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
  776.     PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
  777.     PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START2 )
  778.     PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_TILT )
  779.     PORT_SERVICE( 0x0020, IP_ACTIVE_LOW )
  780.     PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_COIN4 )
  781.     PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
  782.     PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER1 )
  783.     PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER1 )
  784.     PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER1 )
  785.     PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
  786.     PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  787.     PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  788.     PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
  789.     PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
  790.  
  791.     PORT_START
  792.     PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNUSED )
  793.     PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  794.     PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  795.     PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
  796.     PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
  797.     PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_UNUSED )    /* player 1 joystick goes here */
  798.  
  799.     PORT_START
  800.     PORT_DIPNAME( 0x0003, 0x0003, "Game Time" )
  801.     PORT_DIPSETTING(      0x0000, "Shortest" )
  802.     PORT_DIPSETTING(      0x0002, "Short" )
  803.     PORT_DIPSETTING(      0x0003, "Medium" )
  804.     PORT_DIPSETTING(      0x0001, "Long" )
  805.     PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Coinage ) )
  806.     PORT_DIPSETTING(      0x0008, DEF_STR( 2C_1C ) )
  807.     PORT_DIPSETTING(      0x000c, DEF_STR( 1C_1C ) )
  808.     PORT_DIPSETTING(      0x0000, DEF_STR( Free_Play ) )
  809.     PORT_DIPSETTING(      0x0004, "Set Your Own" )
  810.     PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Demo_Sounds ) )
  811.     PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
  812.     PORT_DIPSETTING(      0x0010, DEF_STR( On ) )
  813.     PORT_DIPNAME( 0x0020, 0x0020, "Test Switch" )
  814.     PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
  815.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  816.     PORT_DIPNAME( 0x0040, 0x0040, "Coin Chutes" )
  817.     PORT_DIPSETTING(      0x0000, "Individual" )
  818.     PORT_DIPSETTING(      0x0040, "Common" )
  819.     PORT_DIPNAME( 0x0080, 0x0080, "Joystick" )
  820.     PORT_DIPSETTING(      0x0080, "Standard" )
  821.     PORT_DIPSETTING(      0x0000, "Rotated" )
  822.     PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_UNUSED )    /* player 2 joystick goes here */
  823.  
  824.     PORT_START    /* 49-way joystick simulator */
  825.     PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
  826.     PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER1 )
  827.     PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER1 )
  828.     PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER1 )
  829.     PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  830.     PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
  831.     PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
  832.     PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
  833. INPUT_PORTS_END
  834.  
  835.  
  836. INPUT_PORTS_START( trisport )
  837.     PORT_START
  838.     PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
  839.     PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
  840.     PORT_BIT( 0x000c, IP_ACTIVE_LOW, IPT_UNUSED )
  841.     PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_TILT )
  842.     PORT_SERVICE( 0x0020, IP_ACTIVE_LOW )
  843.     PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_COIN4 )
  844.     PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
  845.     PORT_BIT( 0x0f00, IP_ACTIVE_LOW, IPT_UNUSED )
  846.     PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  847.     PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_START1 )
  848.     PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  849.     PORT_BIT( 0xc000, IP_ACTIVE_LOW, IPT_UNUSED )
  850.  
  851.     PORT_START
  852.     PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
  853.     PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_UNUSED )    /* analog controls go here */
  854.  
  855.     PORT_START
  856.     PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) )
  857.     PORT_DIPSETTING(      0x0002, DEF_STR( 4C_1C ) )
  858.     PORT_DIPSETTING(      0x0003, DEF_STR( 3C_1C ) )
  859.     PORT_DIPSETTING(      0x0006, DEF_STR( 2C_1C ) )
  860.     PORT_DIPSETTING(      0x0007, DEF_STR( 1C_1C ) )
  861.     PORT_DIPSETTING(      0x0005, DEF_STR( 1C_2C ) )
  862.     PORT_DIPSETTING(      0x0004, DEF_STR( 1C_3C ) )
  863.     PORT_DIPSETTING(      0x0001, DEF_STR( Free_Play ) )
  864.     PORT_DIPSETTING(      0x0000, "Battery Options" )
  865.     PORT_DIPNAME( 0x0018, 0x0018, "Pool Turns" )
  866.     PORT_DIPSETTING(      0x0010, "5" )
  867.     PORT_DIPSETTING(      0x0008, "6" )
  868.     PORT_DIPSETTING(      0x0018, "7" )
  869.     PORT_DIPSETTING(      0x0000, "8" )
  870.     PORT_DIPNAME( 0x0020, 0x0020, "Bowling Difficulty" )
  871.     PORT_DIPSETTING(      0x0020, "Standard" )
  872.     PORT_DIPSETTING(      0x0000, "Advanced" )
  873.     PORT_DIPNAME( 0x0040, 0x0040, "Shot Timer" )
  874.     PORT_DIPSETTING(      0x0000, "Slower" )
  875.     PORT_DIPSETTING(      0x0040, "Standard" )
  876.     PORT_DIPNAME( 0x0080, 0x0080, "Golf Holes" )
  877.     PORT_DIPSETTING(      0x0080, "3" )
  878.     PORT_DIPSETTING(      0x0000, "4" )
  879.     PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
  880.  
  881.     PORT_START
  882.     PORT_ANALOG( 0xff, 0, IPT_TRACKBALL_X | IPF_PLAYER1, 100, 20, 0, 0 )
  883.  
  884.     PORT_START
  885.     PORT_ANALOG( 0xff, 0, IPT_TRACKBALL_Y | IPF_REVERSE | IPF_PLAYER1, 100, 20, 0, 0 )
  886. INPUT_PORTS_END
  887.  
  888.  
  889.  
  890. /*************************************
  891.  *
  892.  *    Graphics definitions
  893.  *
  894.  *************************************/
  895.  
  896. static struct GfxLayout zwackery_layout =
  897. {
  898.     16,16,
  899.     RGN_FRAC(1,2),
  900.     8,
  901.     { 0, 0, 0, 0, 0, 0, 0, 0 },
  902.     {  3,  2,  1,  0, 11, 10,  9,  8,
  903.       19, 18, 17, 16, 27, 26, 25, 24 },
  904.     { 4, RGN_FRAC(1,2)+4, 0, RGN_FRAC(1,2)+0, 36, RGN_FRAC(1,2)+36, 32, RGN_FRAC(1,2)+32,
  905.       68, RGN_FRAC(1,2)+68, 64, RGN_FRAC(1,2)+64, 100, RGN_FRAC(1,2)+100, 96, RGN_FRAC(1,2)+96 },
  906.     128
  907. };
  908.  
  909. static struct GfxDecodeInfo gfxdecodeinfo[] =
  910. {
  911.     { REGION_GFX1, 0, &mcr_bg_layout,     0, 4 },
  912.     { REGION_GFX2, 0, &mcr_sprite_layout, 0, 4 },
  913.     { -1 } /* end of array */
  914. };
  915.  
  916. static struct GfxDecodeInfo zwackery_gfxdecodeinfo[] =
  917. {
  918.     { REGION_GFX1, 0, &zwackery_layout,       0, 16 },
  919.     { REGION_GFX2, 0, &mcr_sprite_layout, 0x800, 32 },
  920.     { REGION_GFX1, 0, &zwackery_layout,       0, 16 },    /* yes, an extra copy */
  921.     { -1 } /* end of array */
  922. };
  923.  
  924.  
  925.  
  926. /*************************************
  927.  *
  928.  *    Machine drivers
  929.  *
  930.  *************************************/
  931.  
  932. /*=================================================================
  933.  
  934.     Timing for these games is crucial. They all use the 6840 timer
  935.     to preemptively multitask during each frame. The clock on the
  936.     6840 timer is taken from the 68000's E clock, which runs at
  937.     1/10th the speed of the 68000 itself.
  938.  
  939.     All the games run in a sequence of six steps per frame, using
  940.     counter 1 on the 6840 to time each step. The sum total of the
  941.     6 programmed steps for each game determines how many E clocks
  942.     should be generated per frame, which in turn determines the
  943.     clock we should expect the CPU to have.
  944.  
  945.     Ideal CPU timings, based on counter usage:
  946.  
  947.         Zwackery:     7652400
  948.         Xenophobe:    7723800
  949.         Spy Hunter 2: 7723800
  950.         Blasted:      7798800
  951.         Arch Rivals:  7799100
  952.         Pigskin:      9211200
  953.         Tri-Sports:   9211200
  954.  
  955.     Currently, we are using the Xenophobe CPU for the first four
  956.     until we spot problems.
  957.  
  958. =================================================================*/
  959.  
  960. static struct MachineDriver machine_driver_zwackery =
  961. {
  962.     /* basic machine hardware */
  963.     {
  964.         {
  965.             CPU_M68000,
  966.             7652400,    /* 8 Mhz */
  967.             zwackery_readmem,zwackery_writemem,0,0,
  968.             mcr68_interrupt,1
  969.         },
  970.         SOUND_CPU_CHIP_SQUEAK_DELUXE
  971.     },
  972.     30, DEFAULT_REAL_30HZ_VBLANK_DURATION,
  973.     1,
  974.     zwackery_init_machine,
  975.  
  976.     /* video hardware */
  977.     32*16, 30*16, { 0, 32*16-1, 0, 30*16-1 },
  978.     zwackery_gfxdecodeinfo,
  979.     4096, 4096,
  980.     zwackery_convert_color_prom,
  981.  
  982.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_SUPPORTS_DIRTY,
  983.     0,
  984.     generic_vh_start,
  985.     generic_vh_stop,
  986.     zwackery_vh_screenrefresh,
  987.  
  988.     /* sound hardware */
  989.     SOUND_SUPPORTS_STEREO,0,0,0,
  990.     {
  991.         SOUND_CHIP_SQUEAK_DELUXE
  992.     },
  993.     0
  994. };
  995.  
  996.  
  997. #define MACHINE_DRIVER_MCR68(NAME, MEMMAP, SOUND)         \
  998. static struct MachineDriver machine_driver_##NAME =        \
  999. {                                                        \
  1000.     /* basic machine hardware */                        \
  1001.     {                                                    \
  1002.         {                                                \
  1003.             CPU_M68000,                                    \
  1004.             7723800,    /* 8 Mhz */                        \
  1005.             MEMMAP##_readmem,MEMMAP##_writemem,0,0,        \
  1006.             mcr68_interrupt,1                            \
  1007.         },                                                \
  1008.         SOUND_CPU_##SOUND                                \
  1009.     },                                                    \
  1010.     30, DEFAULT_REAL_30HZ_VBLANK_DURATION,                \
  1011.     1,                                                    \
  1012.     mcr68_init_machine,                                    \
  1013.                                                         \
  1014.     /* video hardware */                                \
  1015.     32*16, 30*16, { 0, 32*16-1, 0, 30*16-1 },            \
  1016.     gfxdecodeinfo,                                        \
  1017.     8*16, 8*16,                                            \
  1018.     0,                                                    \
  1019.                                                         \
  1020.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_SUPPORTS_DIRTY,\
  1021.     0,                                                    \
  1022.     generic_vh_start,                                    \
  1023.     generic_vh_stop,                                    \
  1024.     mcr68_vh_screenrefresh,                                \
  1025.                                                         \
  1026.     /* sound hardware */                                \
  1027.     SOUND_SUPPORTS_STEREO,0,0,0,                        \
  1028.     {                                                    \
  1029.         SOUND_##SOUND                                    \
  1030.     },                                                    \
  1031.     0                                                    \
  1032. };
  1033.  
  1034. MACHINE_DRIVER_MCR68(xenophob, mcr68,    SOUNDS_GOOD)
  1035. MACHINE_DRIVER_MCR68(spyhunt2, mcr68,    TURBO_CHIP_SQUEAK_PLUS_SOUNDS_GOOD)
  1036. MACHINE_DRIVER_MCR68(archrivl, mcr68,    WILLIAMS_CVSD)
  1037. MACHINE_DRIVER_MCR68(pigskin,  pigskin,  WILLIAMS_CVSD)
  1038. MACHINE_DRIVER_MCR68(trisport, trisport, WILLIAMS_CVSD)
  1039.  
  1040.  
  1041.  
  1042. /*************************************
  1043.  *
  1044.  *    ROM decoding
  1045.  *
  1046.  *************************************/
  1047.  
  1048. static void rom_decode(void)
  1049. {
  1050.     int i;
  1051.  
  1052.     /* tile graphics are inverted */
  1053.     for (i = 0; i < memory_region_length(REGION_GFX1); i++)
  1054.         memory_region(REGION_GFX1)[i] ^= 0xff;
  1055. }
  1056.  
  1057.  
  1058.  
  1059. /*************************************
  1060.  *
  1061.  *    ROM definitions
  1062.  *
  1063.  *************************************/
  1064.  
  1065. ROM_START( zwackery )
  1066.     ROM_REGION( 0x40000, REGION_CPU1 )
  1067.     ROM_LOAD_EVEN( "pro0.bin",   0x00000, 0x4000, 0x6fb9731c )
  1068.     ROM_LOAD_ODD ( "pro1.bin",   0x00000, 0x4000, 0x84b92555 )
  1069.     ROM_LOAD_EVEN( "pro2.bin",   0x08000, 0x4000, 0xe6977a2a )
  1070.     ROM_LOAD_ODD ( "pro3.bin",   0x08000, 0x4000, 0xf5d0a60e )
  1071.     ROM_LOAD_EVEN( "pro4.bin",   0x10000, 0x4000, 0xec5841d9 )
  1072.     ROM_LOAD_ODD ( "pro5.bin",   0x10000, 0x4000, 0xd7d99ce0 )
  1073.     ROM_LOAD_EVEN( "pro6.bin",   0x18000, 0x4000, 0xb9fe7bf5 )
  1074.     ROM_LOAD_ODD ( "pro7.bin",   0x18000, 0x4000, 0x5e261b3b )
  1075.     ROM_LOAD_EVEN( "pro8.bin",   0x20000, 0x4000, 0x55e380a5 )
  1076.     ROM_LOAD_ODD ( "pro9.bin",   0x20000, 0x4000, 0x12249dca )
  1077.     ROM_LOAD_EVEN( "pro10.bin",  0x28000, 0x4000, 0x6a39a8ca )
  1078.     ROM_LOAD_ODD ( "pro11.bin",  0x28000, 0x4000, 0xad6b45bc )
  1079.     ROM_LOAD_EVEN( "pro12.bin",  0x30000, 0x4000, 0xe2d25e1f )
  1080.     ROM_LOAD_ODD ( "pro13.bin",  0x30000, 0x4000, 0xe131f9b8 )
  1081.  
  1082.     ROM_REGION( 0x20000, REGION_CPU2 )
  1083.     ROM_LOAD_EVEN( "csd7.bin",  0x00000, 0x2000, 0x5501f54b )
  1084.     ROM_LOAD_ODD ( "csd17.bin", 0x00000, 0x2000, 0x2e482580 )
  1085.     ROM_LOAD_EVEN( "csd8.bin",  0x04000, 0x2000, 0x13366575 )
  1086.     ROM_LOAD_ODD ( "csd18.bin", 0x04000, 0x2000, 0xbcfe5820 )
  1087.  
  1088.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1089.     ROM_LOAD( "tileh.bin",    0x00000, 0x4000, 0xa7237eb1 )
  1090.     ROM_LOAD( "tileg.bin",    0x04000, 0x4000, 0x626cc69b )
  1091.  
  1092.     ROM_REGION( 0x20000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1093.     ROM_LOAD( "spr6h.bin",    0x00000, 0x4000, 0xa51158dc )
  1094.     ROM_LOAD( "spr7h.bin",    0x04000, 0x4000, 0x941feecf )
  1095.     ROM_LOAD( "spr6j.bin",    0x08000, 0x4000, 0xf3eef316 )
  1096.     ROM_LOAD( "spr7j.bin",    0x0c000, 0x4000, 0xa8a34033 )
  1097.     ROM_LOAD( "spr10h.bin",   0x10000, 0x4000, 0xa99daea6 )
  1098.     ROM_LOAD( "spr11h.bin",   0x14000, 0x4000, 0xc1a767fb )
  1099.     ROM_LOAD( "spr10j.bin",   0x18000, 0x4000, 0x4dd04376 )
  1100.     ROM_LOAD( "spr11j.bin",   0x1c000, 0x4000, 0xe8c6a880 )
  1101.  
  1102.     ROM_REGION( 0x8000, REGION_GFX3 )    /* bg color maps */
  1103.     ROM_LOAD_GFX_EVEN( "tilef.bin",  0x0000, 0x4000, 0xa0dfcd7e )
  1104.     ROM_LOAD_GFX_ODD ( "tilee.bin",  0x0000, 0x4000, 0xab504dc8 )
  1105. ROM_END
  1106.  
  1107. ROM_START( xenophob )
  1108.     ROM_REGION( 0x40000, REGION_CPU1 )
  1109.     ROM_LOAD_EVEN( "xeno_pro.3c",  0x00000, 0x10000, 0xf44c2e60 )
  1110.     ROM_LOAD_ODD ( "xeno_pro.3b",  0x00000, 0x10000, 0x01609a3b )
  1111.     ROM_LOAD_EVEN( "xeno_pro.2c",  0x20000, 0x10000, 0xe45bf669 )
  1112.     ROM_LOAD_ODD ( "xeno_pro.2b",  0x20000, 0x10000, 0xda5d39d5 )
  1113.  
  1114.     ROM_REGION( 0x40000, REGION_CPU2 )  /* Sounds Good board */
  1115.     ROM_LOAD_EVEN( "xeno_snd.u7",  0x00000, 0x10000, 0x77561d15 )
  1116.     ROM_LOAD_ODD ( "xeno_snd.u17", 0x00000, 0x10000, 0x837a1a71 )
  1117.     ROM_LOAD_EVEN( "xeno_snd.u8",  0x20000, 0x10000, 0x6e2915c7 )
  1118.     ROM_LOAD_ODD ( "xeno_snd.u18", 0x20000, 0x10000, 0x12492145 )
  1119.  
  1120.     ROM_REGION( 0x10000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1121.     ROM_LOAD( "xeno_bg.11d",  0x00000, 0x08000, 0x3d2cf284 )
  1122.     ROM_LOAD( "xeno_bg.12d",  0x08000, 0x08000, 0xc32288b1 )
  1123.  
  1124.     ROM_REGION( 0x40000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1125.     ROM_LOAD( "xeno_fg.7j",   0x00000, 0x10000, 0xb12eddb2 )
  1126.     ROM_LOAD( "xeno_fg.8j",   0x10000, 0x10000, 0x20e682f5 )
  1127.     ROM_LOAD( "xeno_fg.9j",   0x20000, 0x10000, 0x82fb3e09 )
  1128.     ROM_LOAD( "xeno_fg.10j",  0x30000, 0x10000, 0x6a7a3516 )
  1129. ROM_END
  1130.  
  1131. ROM_START( spyhunt2 )
  1132.     ROM_REGION( 0x40000, REGION_CPU1 )
  1133.     ROM_LOAD_EVEN( "sh23c.bin",  0x00000, 0x10000, 0x30b91c90 )
  1134.     ROM_LOAD_ODD ( "sh23b.bin",  0x00000, 0x10000, 0xf64513c6 )
  1135.     ROM_LOAD_EVEN( "sh22c.bin",  0x20000, 0x10000, 0x8ee65009 )
  1136.     ROM_LOAD_ODD ( "sh22b.bin",  0x20000, 0x10000, 0x850c21ad )
  1137.  
  1138.     ROM_REGION( 0x10000, REGION_CPU2 )  /* 64k for the Turbo Cheap Squeak */
  1139.     ROM_LOAD( "turbo-cs.u5", 0x08000, 0x4000, 0x4b1d8a66 )
  1140.     ROM_LOAD( "turbo-cs.u4", 0x0c000, 0x4000, 0x3722ce48 )
  1141.  
  1142.     ROM_REGION( 0x40000, REGION_CPU3 )  /* Sounds Good board */
  1143.     ROM_LOAD_EVEN( "sh2u7.bin",  0x00000, 0x10000, 0x02362ea4 )
  1144.     ROM_LOAD_ODD ( "sh2u17.bin", 0x00000, 0x10000, 0xe29a2c37 )
  1145.  
  1146.     ROM_REGION( 0x10000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1147.     ROM_LOAD( "sh2bg0.bin",  0x00000, 0x08000, 0xcb3c3d8e )
  1148.     ROM_LOAD( "sh2bg1.bin",  0x08000, 0x08000, 0x029d4af1 )
  1149.  
  1150.     ROM_REGION( 0x80000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1151.     ROM_LOAD( "fg0.7j",   0x00000, 0x20000, 0x55ce12ea )
  1152.     ROM_LOAD( "fg1.8j",   0x20000, 0x20000, 0x692afb67 )
  1153.     ROM_LOAD( "fg2.9j",   0x40000, 0x20000, 0xf1aba383 )
  1154.     ROM_LOAD( "fg3.10j",  0x60000, 0x20000, 0xd3475ff8 )
  1155. ROM_END
  1156.  
  1157. ROM_START( spyhnt2a )
  1158.     ROM_REGION( 0x40000, REGION_CPU1 )
  1159.     ROM_LOAD_EVEN( "3c",  0x00000, 0x10000, 0x5b92aadf )
  1160.     ROM_LOAD_ODD ( "3b",  0x00000, 0x10000, 0x6ed0a25f )
  1161.     ROM_LOAD_EVEN( "2c",  0x20000, 0x10000, 0xbc834f3f )
  1162.     ROM_LOAD_ODD ( "2b",  0x20000, 0x10000, 0x8a9f7ef3 )
  1163.  
  1164.     ROM_REGION( 0x10000, REGION_CPU2 )  /* 64k for the Turbo Cheap Squeak */
  1165.     ROM_LOAD( "turbo-cs.u5", 0x08000, 0x4000, 0x4b1d8a66 )
  1166.     ROM_LOAD( "turbo-cs.u4", 0x0c000, 0x4000, 0x3722ce48 )
  1167.  
  1168.     ROM_REGION( 0x40000, REGION_CPU3 )  /* Sounds Good board */
  1169.     ROM_LOAD_EVEN( "sh2u7.bin",  0x00000, 0x10000, 0x02362ea4 )
  1170.     ROM_LOAD_ODD ( "sh2u17.bin", 0x00000, 0x10000, 0xe29a2c37 )
  1171.  
  1172.     ROM_REGION( 0x10000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1173.     ROM_LOAD( "bg0.11d",  0x00000, 0x08000, 0x81efef7a )
  1174.     ROM_LOAD( "bg1.12d",  0x08000, 0x08000, 0x6a902e4d )
  1175.  
  1176.     ROM_REGION( 0x80000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1177.     ROM_LOAD( "fg0.7j",   0x00000, 0x20000, 0x55ce12ea )
  1178.     ROM_LOAD( "fg1.8j",   0x20000, 0x20000, 0x692afb67 )
  1179.     ROM_LOAD( "fg2.9j",   0x40000, 0x20000, 0xf1aba383 )
  1180.     ROM_LOAD( "fg3.10j",  0x60000, 0x20000, 0xd3475ff8 )
  1181. ROM_END
  1182.  
  1183. ROM_START( blasted )
  1184.     ROM_REGION( 0x40000, REGION_CPU1 )
  1185.     ROM_LOAD_EVEN( "3c",  0x00000, 0x10000, 0xb243b7df )
  1186.     ROM_LOAD_ODD ( "3b",  0x00000, 0x10000, 0x627e30d3 )
  1187.     ROM_LOAD_EVEN( "2c",  0x20000, 0x10000, 0x026f30bf )
  1188.     ROM_LOAD_ODD ( "2b",  0x20000, 0x10000, 0x8e0e91a9 )
  1189.  
  1190.     ROM_REGION( 0x40000, REGION_CPU2 )  /* Sounds Good board */
  1191.     ROM_LOAD_EVEN( "blasted.u7",  0x00000, 0x10000, 0x8d7c8ef6 )
  1192.     ROM_LOAD_ODD ( "blasted.u17", 0x00000, 0x10000, 0xc79040b9 )
  1193.     ROM_LOAD_EVEN( "blasted.u8",  0x20000, 0x10000, 0xc53094c0 )
  1194.     ROM_LOAD_ODD ( "blasted.u18", 0x20000, 0x10000, 0x85688160 )
  1195.  
  1196.     ROM_REGION( 0x10000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1197.     ROM_LOAD( "11d",  0x00000, 0x08000, 0xd8ed5cbc )
  1198.     ROM_LOAD( "12d",  0x08000, 0x08000, 0x60d00c69 )
  1199.  
  1200.     ROM_REGION( 0x80000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1201.     ROM_LOAD( "fg0",  0x00000, 0x20000, 0x5034ae8a )
  1202.     ROM_LOAD( "fg1",  0x20000, 0x20000, 0x4fbdba58 )
  1203.     ROM_LOAD( "fg2",  0x40000, 0x20000, 0x8891f6f8 )
  1204.     ROM_LOAD( "fg3",  0x60000, 0x20000, 0x18e4a130 )
  1205. ROM_END
  1206.  
  1207. ROM_START( archrivl )
  1208.     ROM_REGION( 0x40000, REGION_CPU1 )
  1209.     ROM_LOAD_EVEN( "3c-rev2",  0x00000, 0x10000, 0x60d4b760 )
  1210.     ROM_LOAD_ODD ( "3b-rev2",  0x00000, 0x10000, 0xe0c07a8d )
  1211.     ROM_LOAD_EVEN( "2c-rev2",  0x20000, 0x10000, 0xcc2893f7 )
  1212.     ROM_LOAD_ODD ( "2b-rev2",  0x20000, 0x10000, 0xfa977050 )
  1213.  
  1214.     ROM_REGION( 0x70000, REGION_CPU2 )  /* Audio System board */
  1215.     ROM_LOAD( "u4.snd",  0x10000, 0x08000, 0x96b3c652 )
  1216.     ROM_LOAD( "u19.snd", 0x30000, 0x08000, 0xc4b3dc23 )
  1217.     ROM_LOAD( "u20.snd", 0x50000, 0x08000, 0xf7907a02 )
  1218.  
  1219.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1220.     ROM_LOAD( "11d-rev1",  0x00000, 0x10000, 0x7eb3d7c6 )
  1221.     ROM_LOAD( "12d-rev1",  0x10000, 0x10000, 0x31e68050 )
  1222.  
  1223.     ROM_REGION( 0x80000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1224.     ROM_LOAD( "7j-rev1",   0x00000, 0x20000, 0x148ce28c )
  1225.     ROM_LOAD( "8j-rev1",   0x20000, 0x20000, 0x58187ac2 )
  1226.     ROM_LOAD( "9j-rev1",   0x40000, 0x20000, 0x0dd1204e )
  1227.     ROM_LOAD( "10j-rev1",  0x60000, 0x20000, 0xeb3d0344 )
  1228. ROM_END
  1229.  
  1230. ROM_START( archriv2 )
  1231.     ROM_REGION( 0x40000, REGION_CPU1 )
  1232.     ROM_LOAD_EVEN( "archrivl.4",  0x00000, 0x10000, 0x3c545740 )
  1233.     ROM_LOAD_ODD ( "archrivl.2",  0x00000, 0x10000, 0xbc4df2b9 )
  1234.     ROM_LOAD_EVEN( "archrivl.3",  0x20000, 0x10000, 0xd6d08ff7 )
  1235.     ROM_LOAD_ODD ( "archrivl.1",  0x20000, 0x10000, 0x92f3a43d )
  1236.  
  1237.     ROM_REGION( 0x70000, REGION_CPU2 )  /* Audio System board */
  1238.     ROM_LOAD( "u4.snd",  0x10000, 0x08000, 0x96b3c652 )
  1239.     ROM_LOAD( "u19.snd", 0x30000, 0x08000, 0xc4b3dc23 )
  1240.     ROM_LOAD( "u20.snd", 0x50000, 0x08000, 0xf7907a02 )
  1241.  
  1242.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1243.     ROM_LOAD( "11d-rev1",  0x00000, 0x10000, 0x7eb3d7c6 )
  1244.     ROM_LOAD( "12d-rev1",  0x10000, 0x10000, 0x31e68050 )
  1245.  
  1246.     ROM_REGION( 0x80000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1247.     ROM_LOAD( "7j-rev1",   0x00000, 0x20000, 0x148ce28c )
  1248.     ROM_LOAD( "8j-rev1",   0x20000, 0x20000, 0x58187ac2 )
  1249.     ROM_LOAD( "9j-rev1",   0x40000, 0x20000, 0x0dd1204e )
  1250.     ROM_LOAD( "10j-rev1",  0x60000, 0x20000, 0xeb3d0344 )
  1251. ROM_END
  1252.  
  1253. ROM_START( pigskin )
  1254.     ROM_REGION( 0x40000, REGION_CPU1 )
  1255.     ROM_LOAD_EVEN( "pigskin.a5",  0x00000, 0x10000, 0xab61c29b )
  1256.     ROM_LOAD_ODD ( "pigskin.b5",  0x00000, 0x10000, 0x55a802aa )
  1257.     ROM_LOAD_EVEN( "pigskin.a6",  0x20000, 0x10000, 0x4d8b7e50 )
  1258.     ROM_LOAD_ODD ( "pigskin.b6",  0x20000, 0x10000, 0x1194f187 )
  1259.  
  1260.     ROM_REGION( 0x70000, REGION_CPU2 )  /* Audio System board */
  1261.     ROM_LOAD( "pigskin.u4",  0x10000, 0x10000, 0x6daf2d37 )
  1262.     ROM_LOAD( "pigskin.u19", 0x30000, 0x10000, 0x56fd16a3 )
  1263.     ROM_LOAD( "pigskin.u20", 0x50000, 0x10000, 0x5d032fb8 )
  1264.  
  1265.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1266.     ROM_LOAD( "pigskin.e2",  0x00000, 0x10000, 0x12d5737b )
  1267.     ROM_LOAD( "pigskin.e1",  0x10000, 0x10000, 0x460202a9 )
  1268.  
  1269.     ROM_REGION( 0x80000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1270.     ROM_LOAD( "pigskin.h15", 0x00000, 0x20000, 0x2655d03f )
  1271.     ROM_LOAD( "pigskin.h17", 0x20000, 0x20000, 0x31c52ea7 )
  1272.     ROM_LOAD( "pigskin.h18", 0x40000, 0x20000, 0xb36c4109 )
  1273.     ROM_LOAD( "pigskin.h14", 0x60000, 0x20000, 0x09c87104 )
  1274. ROM_END
  1275.  
  1276. ROM_START( trisport )
  1277.     ROM_REGION( 0x40000, REGION_CPU1 )
  1278.     ROM_LOAD_EVEN( "la3.a5",  0x00000, 0x10000, 0xfe1e9e37 )
  1279.     ROM_LOAD_ODD ( "la3.b5",  0x00000, 0x10000, 0xf352ec81 )
  1280.     ROM_LOAD_EVEN( "la3.a6",  0x20000, 0x10000, 0x9c6a1398 )
  1281.     ROM_LOAD_ODD ( "la3.b6",  0x20000, 0x10000, 0x597b564c )
  1282.  
  1283.     ROM_REGION( 0x70000, REGION_CPU2 )  /* Audio System board */
  1284.     ROM_LOAD( "sl1-snd.u4",  0x10000, 0x10000, 0x0ed8c904 )
  1285.     ROM_LOAD( "sl1-snd.u19", 0x30000, 0x10000, 0xb57d7d7e )
  1286.     ROM_LOAD( "sl1-snd.u20", 0x50000, 0x08000, 0x3ae15c08 )
  1287.  
  1288.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1289.     ROM_LOAD( "la2.e2",  0x00000, 0x10000, 0xf61149a0 )
  1290.     ROM_LOAD( "la2.e1",  0x10000, 0x10000, 0xcf753497 )
  1291.  
  1292.     ROM_REGION( 0x80000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1293.     ROM_LOAD( "la2.h15", 0x00000, 0x20000, 0x18a44d43 )
  1294.     ROM_LOAD( "la2.h17", 0x20000, 0x20000, 0x874cd237 )
  1295.     ROM_LOAD( "la2.h18", 0x40000, 0x20000, 0xf7637a18 )
  1296.     ROM_LOAD( "la2.h14", 0x60000, 0x20000, 0x403f9401 )
  1297. ROM_END
  1298.  
  1299.  
  1300.  
  1301. /*************************************
  1302.  *
  1303.  *    Driver initialization
  1304.  *
  1305.  *************************************/
  1306.  
  1307. static void init_zwackery(void)
  1308. {
  1309.     MCR_CONFIGURE_SOUND(MCR_CHIP_SQUEAK_DELUXE);
  1310.  
  1311.     /* Zwackery doesn't care too much about this value; currently taken from Blasted */
  1312.     mcr68_timing_factor = (256.0 + 16.0) / (double)(Machine->drv->cpu[0].cpu_clock / 10);
  1313.  
  1314.     rom_decode();
  1315. }
  1316.  
  1317.  
  1318. static void init_xenophob(void)
  1319. {
  1320.     MCR_CONFIGURE_SOUND(MCR_SOUNDS_GOOD);
  1321.  
  1322.     mcr68_sprite_clip = 0;
  1323.     mcr68_sprite_xoffset = 0;
  1324.  
  1325.     /* Xenophobe doesn't care too much about this value; currently taken from Blasted */
  1326.     mcr68_timing_factor = (256.0 + 16.0) / (double)(Machine->drv->cpu[0].cpu_clock / 10);
  1327.  
  1328.     /* install control port handler */
  1329.     install_mem_write_handler(0, 0x0c0000, 0x0cffff, xenophobe_control_w);
  1330.  
  1331.     rom_decode();
  1332. }
  1333.  
  1334.  
  1335. static void init_spyhunt2(void)
  1336. {
  1337.     MCR_CONFIGURE_SOUND(MCR_TURBO_CHIP_SQUEAK | MCR_SOUNDS_GOOD);
  1338.  
  1339.     mcr68_sprite_clip = 0;
  1340.     mcr68_sprite_xoffset = -6;
  1341.  
  1342.     /* Spy Hunter 2 doesn't care too much about this value; currently taken from Blasted */
  1343.     mcr68_timing_factor = (256.0 + 16.0) / (double)(Machine->drv->cpu[0].cpu_clock / 10);
  1344.  
  1345.     /* analog port handling is a bit tricky */
  1346.     install_mem_write_handler(0, 0x0c0000, 0x0cffff, spyhunt2_control_w);
  1347.     install_mem_read_handler(0, 0x0d0000, 0x0dffff, spyhunt2_port_0_r);
  1348.     install_mem_read_handler(0, 0x0e0000, 0x0effff, spyhunt2_port_1_r);
  1349.  
  1350.     rom_decode();
  1351. }
  1352.  
  1353.  
  1354. static void init_blasted(void)
  1355. {
  1356.     MCR_CONFIGURE_SOUND(MCR_SOUNDS_GOOD);
  1357.  
  1358.     mcr68_sprite_clip = 0;
  1359.     mcr68_sprite_xoffset = 0;
  1360.  
  1361.     /* Blasted checks the timing of VBLANK relative to the 493 interrupt */
  1362.     /* VBLANK is required to come within 220-256 E clocks (i.e., 2200-2560 CPU clocks) */
  1363.     /* after the 493; we also allow 16 E clocks for latency  */
  1364.     mcr68_timing_factor = (256.0 + 16.0) / (double)(Machine->drv->cpu[0].cpu_clock / 10);
  1365.  
  1366.     /* handle control writes */
  1367.     install_mem_write_handler(0, 0x0c0000, 0x0cffff, blasted_control_w);
  1368.  
  1369.     /* 6840 is mapped to the lower 8 bits */
  1370.     install_mem_write_handler(0, 0x0a0000, 0x0a000f, mcr68_6840_lower_w);
  1371.     install_mem_read_handler(0, 0x0a0000, 0x0a000f, mcr68_6840_lower_r);
  1372.  
  1373.     rom_decode();
  1374. }
  1375.  
  1376.  
  1377. static void init_archrivl(void)
  1378. {
  1379.     MCR_CONFIGURE_SOUND(MCR_WILLIAMS_SOUND);
  1380.  
  1381.     mcr68_sprite_clip = 16;
  1382.     mcr68_sprite_xoffset = 0;
  1383.  
  1384.     /* Arch Rivals doesn't care too much about this value; currently taken from Blasted */
  1385.     mcr68_timing_factor = (256.0 + 16.0) / (double)(Machine->drv->cpu[0].cpu_clock / 10);
  1386.  
  1387.     /* handle control writes */
  1388.     install_mem_write_handler(0, 0x0c0000, 0x0cffff, archrivl_control_w);
  1389.  
  1390.     /* 49-way joystick handling is a bit tricky */
  1391.     install_mem_read_handler(0, 0x0e0000, 0x0effff, archrivl_port_1_r);
  1392.  
  1393.     /* 6840 is mapped to the lower 8 bits */
  1394.     install_mem_write_handler(0, 0x0a0000, 0x0a000f, mcr68_6840_lower_w);
  1395.     install_mem_read_handler(0, 0x0a0000, 0x0a000f, mcr68_6840_lower_r);
  1396.  
  1397.     /* expand the sound ROMs */
  1398.     memcpy(&memory_region(REGION_CPU2)[0x18000], &memory_region(REGION_CPU2)[0x10000], 0x08000);
  1399.     memcpy(&memory_region(REGION_CPU2)[0x20000], &memory_region(REGION_CPU2)[0x10000], 0x10000);
  1400.     memcpy(&memory_region(REGION_CPU2)[0x38000], &memory_region(REGION_CPU2)[0x30000], 0x08000);
  1401.     memcpy(&memory_region(REGION_CPU2)[0x40000], &memory_region(REGION_CPU2)[0x30000], 0x10000);
  1402.     memcpy(&memory_region(REGION_CPU2)[0x58000], &memory_region(REGION_CPU2)[0x50000], 0x08000);
  1403.     memcpy(&memory_region(REGION_CPU2)[0x60000], &memory_region(REGION_CPU2)[0x50000], 0x10000);
  1404.  
  1405.     rom_decode();
  1406. }
  1407.  
  1408.  
  1409. static void init_pigskin(void)
  1410. {
  1411.     MCR_CONFIGURE_SOUND(MCR_WILLIAMS_SOUND);
  1412.  
  1413.     /* handle control writes */
  1414.     install_mem_write_handler(0, 0x1a0000, 0x1affff, archrivl_control_w);
  1415.  
  1416.     /* Pigskin doesn't care too much about this value; currently taken from Tri-Sports */
  1417.     mcr68_timing_factor = 115.0 / (double)(Machine->drv->cpu[0].cpu_clock / 10);
  1418.  
  1419.     mcr68_sprite_clip = 16;
  1420.     mcr68_sprite_xoffset = 0;
  1421.  
  1422.     /* expand the sound ROMs */
  1423.     memcpy(&memory_region(REGION_CPU2)[0x20000], &memory_region(REGION_CPU2)[0x10000], 0x10000);
  1424.     memcpy(&memory_region(REGION_CPU2)[0x40000], &memory_region(REGION_CPU2)[0x30000], 0x10000);
  1425.     memcpy(&memory_region(REGION_CPU2)[0x60000], &memory_region(REGION_CPU2)[0x50000], 0x10000);
  1426.  
  1427.     rom_decode();
  1428. }
  1429.  
  1430.  
  1431. static void init_trisport(void)
  1432. {
  1433.     MCR_CONFIGURE_SOUND(MCR_WILLIAMS_SOUND);
  1434.  
  1435.     /* Tri-Sports checks the timing of VBLANK relative to the 493 interrupt */
  1436.     /* VBLANK is required to come within 87-119 E clocks (i.e., 870-1190 CPU clocks) */
  1437.     /* after the 493 */
  1438.     mcr68_timing_factor = 115.0 / (double)(Machine->drv->cpu[0].cpu_clock / 10);
  1439.  
  1440.     /* handle control writes */
  1441.     install_mem_write_handler(0, 0x1a0000, 0x1affff, archrivl_control_w);
  1442.  
  1443.     mcr68_sprite_clip = 0;
  1444.     mcr68_sprite_xoffset = 0;
  1445.  
  1446.     /* expand the sound ROMs */
  1447.     memcpy(&memory_region(REGION_CPU2)[0x20000], &memory_region(REGION_CPU2)[0x10000], 0x10000);
  1448.     memcpy(&memory_region(REGION_CPU2)[0x40000], &memory_region(REGION_CPU2)[0x30000], 0x10000);
  1449.     memcpy(&memory_region(REGION_CPU2)[0x58000], &memory_region(REGION_CPU2)[0x50000], 0x08000);
  1450.     memcpy(&memory_region(REGION_CPU2)[0x60000], &memory_region(REGION_CPU2)[0x50000], 0x10000);
  1451.  
  1452.     rom_decode();
  1453. }
  1454.  
  1455.  
  1456.  
  1457. /*************************************
  1458.  *
  1459.  *    Game drivers
  1460.  *
  1461.  *************************************/
  1462.  
  1463. GAME( 1984, zwackery, 0,        zwackery, zwackery, zwackery, ROT0,   "Bally Midway", "Zwackery" )
  1464. GAME( 1987, xenophob, 0,        xenophob, xenophob, xenophob, ROT0,   "Bally Midway", "Xenophobe" )
  1465. GAME( 1987, spyhunt2, 0,        spyhunt2, spyhunt2, spyhunt2, ROT0,   "Bally Midway", "Spy Hunter 2 (rev 2)" )
  1466. GAME( 1987, spyhnt2a, spyhunt2, spyhunt2, spyhunt2, spyhunt2, ROT0,   "Bally Midway", "Spy Hunter 2 (rev 1)" )
  1467. GAME( 1988, blasted,  0,        xenophob, blasted,  blasted,  ROT0,   "Bally Midway", "Blasted" )
  1468. GAME( 1989, archrivl, 0,        archrivl, archrivl, archrivl, ROT0,   "Bally Midway", "Arch Rivals (rev 4.0)" )
  1469. GAME( 1989, archriv2, archrivl, archrivl, archrivl, archrivl, ROT0,   "Bally Midway", "Arch Rivals (rev 2.0)" )
  1470. GAME( 1989, trisport, 0,        trisport, trisport, trisport, ROT270, "Bally Midway", "Tri-Sports" )
  1471. GAME( 1990, pigskin,  0,        pigskin,  pigskin,  pigskin,  ROT0,   "Bally Midway", "Pigskin 621AD" )
  1472.